<div class="crumb-wrap">
            <div class="crumb-list"><i class="icon-font"></i><a href="<?=site_url('admini') ?>">首页</a><span class="crumb-step">&gt;</span><span class="crumb-name">权限管理</span></div>
        </div>
        <div class="result-wrap">
            <form name="myform" id="myform" method="post">
                <div class="result-title">
                    <div class="result-list">
                        <a href="<?=site_url('admini/power/create')?>"><i class="icon-font"></i>权限新增</a>
                        <a id="batchDel" href="javascript:void(0)" onclick="del_all()"><i class="icon-font"></i>批量删除</a>
                        <a href="<?=site_url('admini/groups')?>"><i class="icon-font">&#xe014;</i>管理用户组</a>
                        <?php if(!empty($_GET['pid'])): ?>
                        <a id="updateOrd" href="javascript:history.go(-1)"><i class="icon-font">&#xe010;</i>返回上一页</a>
                        <?php endif;?>
                    </div>
                </div>
                <div class="result-content">
                    <table class="result-tab" width="100%">
                        <tr>
                            <th class="tc" width="5%"><input class="allChoose" name="" id="all" type="checkbox" onclick="check_all()"></th>
                            <th width="5%">编号</th>
                            <th>权限名称</th>
                            <th>菜单名称</th>
                            <th>路由</th>
                            <th>操作</th>
                        </tr>
                        <?php foreach($list as $k => $v): ?>
                        <tr id="list_<?=$v['id'] ?>" class="top_0">
                            <td class="tc"><input name="checkbox" value="<?=$v['id']?>" type="checkbox"></td>
                            <td><?=$v['id'] ?></td>
                            <td title="点击查看下级权限"><a href="<?=site_url('admini/power/index?pid='.$v['id'])?>"><?=$v['name'] ?></a></td>
                            <td><?=$v['menu']?></td>
                            <td title="点击查看"><a href="<?=site_url($v['url'])?>"><?=$v['url']?></a></td>
                            <td>
                                <a class="link-update" href="<?=site_url('admini/power/update?pid='.$v['id'])?>">修改</a>
                                <a class="link-del" href="javascript:del_sort(<?=$v['id']?>)">删除</a>
                            </td>
                        </tr>
                        <?php endforeach;?>
                    </table>
                    <!-- <div class="list-page"> 2 条 1/1 页</div> -->
                </div>
            </form>
        </div>
<script>

    //删除
    function del_sort(id){
        layer.confirm('确定要删除这个分类以及该分类下的所有分类吗？', {
            icon:0,
            btn: ['删除','取消'], //按钮
            shade: false //不显示遮罩
        }, function(){
            $.post("<?=site_url('admini/power/delete')?>",{pid:id},function(res){
                if(res == 1){
                    location.reload(true);
                }else{
                    layer.alert(res,{
                        icon:2,
                    });
                }
            })
        });
    }

    //选中
    function check_all(){
        var v = $('#all').is(':checked');
        $("input[name='checkbox']:checkbox").each(function() {
            this.checked=v;
        })
    }

    //批量删除
    function del_all(){
        layer.confirm('删除之后不能恢复，需要继续吗？', {
            icon:0,
            btn: ['删除','取消'], //按钮
            shade: false //不显示遮罩
        }, function(){
            $("input[name='checkbox']").each(function() {
                if($(this).is(':checked')){
                    var v = $(this).val();
                    $.ajax({
                        url:"<?=site_url('admini/power/delete')?>",
                        type:"post",
                        async:false,
                        data:{pid:v}
                    });
                }
            })
            location.reload(true);
        });
    }

</script>